<template>
    <div id="coming">
        <ul>
            <li v-for="item in comingPlayData" :key="item.id">
                <div class="first">
                    <img :src="item.img" alt="">
                </div>
                <div class="second">
                    <p class="title">{{item.title}}</p>
                    <p><span>{{item.score}} 人想看</span></p>
                    <p class="actors font-color">{{item.actors}}</p>
                    <p class="font-color">{{item.nums}}</p>
                </div>
                <div class="third">
                    <button>预售</button>
                </div>
            </li>

        </ul>
    </div>
</template>

<script>
export default {
    name:'Coming',
    methods:{
    getComingPlayData(){
      var that=this;
      axios.get('/mock/comingPlayData.json')
        .then(function (response) {//请求成功之后的回调函数放里面
        console.log(response);
        if(response.status == 200){
          if(response.data && response.data.comingPlayData){
            that.comingPlayData=response.data.comingPlayData;
          }
        }
  })
        .catch(function (error) {
         console.log(error);
  });
    }
  },
  created(){
    this.getComingPlayData();
  },

    data(){
        return{
            comingPlayData:[]
        }
    }
}
</script>

<style scoped>
    #coming{
        width: 100%;
        padding-bottom: 50px;
    }
    img{
        width: 80px;
    }
    div{
        float: left;
    }
    .first{
        width: 25%;
        margin-bottom: 8px;
    }
    .second{
        width: 58%;
    }
    .actors{
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .third{
        width: 15%;
        text-align: center;
        line-height: 75px;
    }
    li{
        overflow: hidden;
        margin: 10px;
        border-bottom: 1px solid #ccc;
    }
    .title{
        font-size: 18px;
        font-weight: bold;
    }
    p{
        line-height: 25px;
    }
    .font-color{
        color: #666;
    }
    .score{
        color: #f90;
        margin-left: 5px;
        font-weight: bold;
    }
    button{
        background: lightblue;
        width: 45px;
        height: 30px;
        border: none;
        color: white;
        border-radius: 5px;
    }
</style>